package first

import (
    "fmt"
)

func Sayhello(a string) {
    fmt.Println(a)
}

func Ifelse() {
    const a string = "if test"
    const c string = "else test"
    b := 1
    if b == 1 {
        fmt.Println(a)
    } else {
        fmt.Println(c)
    }
}

func SwitchCase() {
    var grade string = "B"
    var marks int = 90

    switch marks {
        case 90: grade = "A"
        case 80: grade = "B"
        case 50, 60, 70: grade = "C"
        default: grade = "B"
    }

    switch grade {
        case "A": fmt.Printf("优秀！")
        default: fmt.Printf("差！")
    }
    fmt.Printf("你的等级是 %s\n", grade ) 
}

func Test(a int) int {
    var b int = 2
    return a + b
}

func Array() {
    var a = [3] int {1,2,3}
    var b = [...]int{1,2,3}
    fmt.Println(a[0])
    fmt.Println(b[1])
}
